package za.um.td.entity;

import za.um.td.ai.FireController;

import com.jme.bounding.BoundingBox;
import com.jme.math.Vector2f;
import com.jme.math.Vector3f;
import com.jme.scene.Node;
import com.jme.scene.shape.Box;

public abstract class Placable extends TerrainEntity {

	protected Vector2f[] placeBlocks;
	protected int numBlocksX, numBlocksZ;
	protected float shootRadius;

	public Placable(String id) {
		super(id);
	}

	public Vector2f[] getPlaceBlocks() {
		return placeBlocks;
	}

	public int getNumBlocksX() {
		return numBlocksX;
	}

	public int getNumBlocksZ() {
		return numBlocksZ;
	}

	public float getShootRadius() {
		return shootRadius;
	}

	// TODO REMOVE
	public void attachController() {
		Box box = new Box("ABox", new Vector3f(0, 1, 0), 1, 1, 1);
		box.setModelBound(new BoundingBox());
		box.updateModelBound();
		box.updateWorldBound();

		Node boxNode = new Node("BOXNODE");
		boxNode.attachChild(box);

		boxNode.setModelBound(new BoundingBox());
		boxNode.updateModelBound();
		boxNode.updateWorldBound();

		Node checkNode = new Node();
		checkNode.attachChild(boxNode);
		checkNode.updateWorldBound();

		getSpatial().addController(
				new FireController((Node) getSpatial(), boxNode, shootRadius,
						checkNode));
	}

}
